/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.breeze.util;

import org.apache.log4j.PropertyConfigurator;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 *
 * @author huateng
 */
public class SpringUtil {
    public static ClassPathXmlApplicationContext ctx=null;
    
    public static ClassPathXmlApplicationContext getContext(){
        if(ctx==null){
            ctx=new ClassPathXmlApplicationContext(new String[]{"classpath:config/newSpringXMLConfig.xml"});
            PropertyConfigurator.configure("src/config/log4j.properties");
        }
        return ctx;
    }
    
    public static Object getBean(String name){
        return getContext().getBean(name);
    }
}
